#include <vector>
#include <string>
#include <boost/python.hpp>

/* Handled by Python
Spawning particles.
Particle creation (with specified parameters such as particle files and appearance).
*/
class pyEmitter;
class pyParticle;


class pyEmitter{
private:
	float x,y;
	int timer; //number of loops before it is run, when timer==0 run pyScript else timer--
	std::vector<pyParticle*> particleList;
	std::vector<int> deleteQeue; //Remove for bool kill. Though not as efficient.
	
	std::vector<std::string> fileNames; //holds all the different particles filenames.
        bool scriptNotRunYet; //Once script is run don't alter fileNames thing
    std::string mainParticleScript;

	std::string emitterFileName; //The python file to run the object

	boost::python::object* global; //python namespace

	float float01;
public:
	pyEmitter();
	pyEmitter(std::string fileName, float x, float y, boost::python::object *namespc); //gets file name and adds it to proper pyEmitterSet
	void update(); //Calls python file
	void particleCleanup(); //handles deletion of qeued particles

	pyParticle& getParticle(int index);
	int getParticleTotal();

	void addToDeleteQeue(int value);
	void createParticle(std::string fileName, float x, float y, float velX, float velY);

	float getX();
	void setX(float x);
	float getY();
	void setY(float y);

	int getTimer();
	void setTimer(int value);

	float getFloat01();
	void setFloat01(float value);
};

class pyParticle{
private:
    std::string fileName;
    bool needsInitializing;
	float x,y;
	float velX, velY;
	int life;

    //Visuals
    float cR, cG, cB; //Color Red/Blue/Green represented as [0,255]
    float alpha; //Alpha value represented as [0,255]
    float width, height;
    std::string textureFileName;
    float rotation;
    std::string blendType;
    //add other modifications to the draw function
public:
	bool kill; //dont need kill, just scan through life.
	pyParticle();
	pyParticle(std::string fileName, int x, int y, float velX, float velY);

	std::string getTextureFileName();
	void setTextureFileName(std::string in);

	float getX();
	void setX(float value);
	float getY();
	void setY(float value);
	float getVelX();
	void setVelX(float value);
	float getVelY();
	void setVelY(float value);

	float getCR();
	void setCR(float value);
	float getCG();
	void setCG(float value);
	float getCB();
	void setCB(float value);
	float getAlpha();
	void setAlpha(float value);
	float getWidth();
	void setWidth(float value);
	float getHeight();
	void setHeight(float value);

	void setRotation(float value);
	float getRotation();
	std::string getBlendType();
	void setBlendType(std::string value);

    std::string getFileName();
    bool initialize();
	void draw();
	int getLife();
	void setLife(int value);
	void lifeCheck(int index, pyEmitter* e);
};

